home *** CD-ROM | disk | FTP | other *** search
- // TSMorph - Amiga Morphing program
- // Copyright (C) © 1993 Topicsave Limited
-
- // This program is free software; you can redistribute it and/or modify
- // it under the terms of the GNU General Public License as published by
- // the Free Software Foundation; either version 2 of the License, or
- // any later version.
-
- // This program is distributed in the hope that it will be useful,
- // but WITHOUT ANY WARRANTY; without even the implied warranty of
- // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- // GNU General Public License for more details.
-
- // You should have received a copy of the GNU General Public License
- // along with this program; if not, write to the Free Software
- // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-
- // mpaddock@cix.compulink.co.uk
-
- #ifndef TSMORPH_H
- #define TSMORPH_H
-
- /* All the Amiga stuff */
- #define INTUI_V36_NAMES_ONLY
- #define INTUITION_IOBSOLETE_H
- #include <exec/types.h>
- #include <exec/memory.h>
- #include <exec/execbase.h>
- #include <intuition/intuition.h>
- #include <intuition/intuitionbase.h>
- #include <intuition/classes.h>
- #include <intuition/classusr.h>
- #include <intuition/gadgetclass.h>
- #include <intuition/imageclass.h>
- #include <intuition/icclass.h>
- #include <devices/input.h>
- #include <workbench/workbench.h>
- #include <workbench/startup.h>
- #include <libraries/gadtools.h>
- #include <graphics/scale.h>
- #include <libraries/asl.h>
- #include <libraries/amigaguide.h>
- #include <libraries/reqtools.h>
- #include <libraries/dctv.h>
-
- /* Various stuff is not defined in 2.02 headers */
- #ifndef PGA_NewLook
- #define PGA_NewLook (PGA_Dummy + 0x000A)
- #endif
-
- #ifndef GTMN_FullMenu
- #define GTMN_FullMenu GT_TagBase+62
- #endif
-
- #ifndef WA_MenuHelp
- #define WA_MenuHelp (WA_Dummy + 0x2F)
- #endif
-
- #ifndef WA_NewLookMenus
- #define WA_NewLookMenus (WA_Dummy + 0x30)
- #endif
-
- #ifndef GTMN_NewLookMenus
- #define GTMN_NewLookMenus GT_TagBase+67
- #endif
-
- #ifndef STRINGA_ExitHelp
- #define STRINGA_ExitHelp (STRINGA_Dummy + 0x0013)
- #endif
-
- #ifndef GT_Underscore
- #define GT_Underscore GT_TagBase+64
- #endif
-
- #ifndef IDCMP_GADGETHELP
- #define IDCMP_GADGETHELP 0x04000000
- #endif
-
- #if INCLUDE_VERSION < 39
- void HelpControl(struct Window *w,ULONG flags);
- #pragma libcall IntuitionBase HelpControl 33C 0802
- void SetRGB32( struct ViewPort *vp, unsigned long n, unsigned long r, unsigned long g,unsigned long b);
- #pragma libcall GfxBase SetRGB32 354 3210805
- void GetRGB32( struct ColorMap *cm, unsigned long firstcolor,unsigned long ncolors, ULONG *table);
- #pragma libcall GfxBase GetRGB32 384 910804
- #endif
-
- #ifndef HC_GADGETHELP
- #define HC_GADGETHELP 1
- #endif
-
- #ifndef SA_Interleaved
- #define SA_Interleaved (SA_Dummy + 0x0022)
- #endif
-
- /* prototypes */
- #include <clib/exec_protos.h>
- #include <clib/dos_protos.h>
- #include <clib/layers_protos.h>
- #include <clib/graphics_protos.h>
- #include <clib/intuition_protos.h>
- #include <clib/input_protos.h>
- #include <clib/gadtools_protos.h>
- #include <clib/asl_protos.h>
- #include <clib/utility_protos.h>
- #include <clib/diskfont_protos.h>
- #include <clib/icon_protos.h>
- #include <clib/amigaguide_protos.h>
- #define LIBRARIES_MATHFFP_H // Do not include other math stuff
- #include <clib/alib_protos.h>
- #include <clib/reqtools_protos.h>
- #include <clib/dctv_protos.h>
-
- /* Pragmas */
- #include <pragmas/exec_pragmas.h>
- #include <pragmas/dos_pragmas.h>
- #include <pragmas/layers_pragmas.h>
- #include <pragmas/graphics_pragmas.h>
- #include <pragmas/intuition_pragmas.h>
- #include <pragmas/input_pragmas.h>
- #include <pragmas/gadtools_pragmas.h>
- #include <pragmas/asl_pragmas.h>
- #include <pragmas/utility_pragmas.h>
- #include <pragmas/diskfont_pragmas.h>
- #include <pragmas/icon_pragmas.h>
- #include <pragmas/amigaguide_pragmas.h>
- #include <pragmas/reqtools.h>
- #include <pragmas/dctv_pragmas.h>
-
- #include <rexx/errors.h>
- #include <pragmas/rexxsyslib_pragmas.h>
- #include <clib/rexxsyslib_protos.h>
-
- /* 2.02 Icon headers */
- #if INCLUDE_VERSION < 37
- BOOL DeleteDiskObject(UBYTE *name);
- #pragma libcall IconBase DeleteDiskObject 8A 801
- #endif
-
- /* Below is not in the 2.02 version of clib/utility_protos.h
- pragmas/utility_pragmas.h */
- #if INCLUDE_VERSION < 37
- LONG Stricmp(UBYTE *string1,UBYTE *string2);
- #pragma libcall UtilityBase Stricmp A2 9802
- #endif
-
- /* Standard headers */
- #include <stddef.h>
- #include <string.h>
- #include <stdio.h>
- #include <math.h>
-
- /* OpalVision */
- #include <opal/opallib.h>
-
- /* EGS */
- #include <egs/clib/egs_protos.h>
- #include <egs/pragmas/egs_pragmas.h>
- #include <egs/clib/egsintui_protos.h>
- #include <egs/pragmas/egsintui_pragmas.h>
- #include <egs/clib/egsgfx_protos.h>
- #include <egs/pragmas/egsgfx_pragmas.h>
- #include <egs/clib/egsrequest_protos.h>
- #include <egs/pragmas/egsrequest_pragmas.h>
- #include <egs/egsintui.h>
- extern struct Library *EGSIntuiBase;
- extern struct Library *EGSGfxBase;
- extern struct Library *EGSBase;
- extern struct Library *EGSRequestBase;
-
- /* define max if not already defined */
- #ifndef max
- #define max(a,b) ((a)>(b)?(a):(b))
- #endif
-
- /* IFF stuff */
- #include "iffp/ILBMapp.h"
-
- /* GUI stuff from GadTools */
- #include "gui.h"
-
- /* Message keys */
- #include "Messages.h"
-
- /* defines for the IDs of the gadgets in the control window */
- #define ONEGADGET 1
- #define TWOGADGET 2
- #define RELGADGET 3
- #define ADDGADGET 4
- #define DELGADGET 5
- #define LINKGADGET 6
- #define UNLINKGADGET 7
- #define NONEGADGET 8
- #define STGADGET 9
- #define PREVGADGET 10
- #define GOTOGADGET 11
- #define NEXTGADGET 12
- #define LASTGADGET 13
-
- /* Defined externally */
- extern struct DosLibrary *DOSBase;
- extern struct ExecBase *SysBase;
-
- /* Structure definitions */
-
- /* Picture structure
- * This holds all information for a picture displayed in a window
- */
- struct Picture { // Structure used for each picture
- struct Screen *Screen; // Screen to display on
- struct Window *Win; // Window
- struct EI_Window *EGS_Win; // EGS Window
- struct E_EBitMap *EGS_BitMap;// EGS Bitmap
- struct DrawInfo *DRI; // Draw Info
- struct Gadget *BotGad; // Bottom slider gadget
- struct Gadget *SideGad; // Side slider gadget
- struct Gadget *Lgad; // Left arrow gadget
- struct Gadget *Rgad; // Right arrow gadget
- struct Gadget *Ugad; // Up arrow gadget
- struct Gadget *Dgad; // Down arrow gadget
- struct Image *Limage; // Left arrow
- struct Image *Rimage; // Right arrow
- struct Image *Uimage; // Up arrow
- struct Image *Dimage; // Down arrow
- UWORD Left; // Left edge
- UWORD Top; // Top edge
- UWORD XLeft; // Old left edge
- UWORD XTop; // Old top edge
- UWORD ALeft; // Left movement 10% of window
- UWORD ATop; // down movement 10% of window
- UWORD MLeft; // Max left edge
- UWORD MTop; // Max top edge
- struct ILBMInfo *ilbm; // ILBM info for iff read
- UWORD currentg; // Current gadgetID
- char *filename; // For Window title
- ULONG JustSeconds;// Time window was activated - to ignore first click
- struct BitMap BitMap; // The zoomed image bitmap
- struct BitScaleArgs BitScaleArgs; // For zooming image
- BOOL Opal; // Set if opened by OpalLoad
- struct {
- WORD Left; // Window Zoom tags - nothing to do with Zoom
- WORD Top;
- WORD Width;
- WORD Height;
- } Zoom;
- UWORD width; // both only valid when EGS
- UWORD height;
- };
-
- #define MAX_LINKS 16
-
- /* Point structure
- * Holds all information for each point
- */
- struct MyPoint {
- struct MinNode MyNode; // Node to link in a list
- WORD x,y; // Coordinates in the 1st image
- WORD x1,y1; // Coordinates in the 2nd image
- WORD NumLinks; // Number of links on this point
- struct MyPoint *p[MAX_LINKS]; // Pointers to up to MAX_LINKS linked points
- };
-
- /* Structure for size of system gadgets
- * based on Screen resolution
- * This enables windows to open with correct
- * gadgets on lo-res screens
- */
- struct gadgetsizing {
- ULONG sysisize; // tag for SYSISIZE_???RES
- int sizeimagew;
- int sizeimageh;
- int leftimagew;
- int leftimageh;
- int downimagew;
- int downimageh;
- int rightimagew;
- int rightimageh;
- int upimagew;
- int upimageh;
- int closeimagew;
- int zoomimagew;
- int depthimagew;
- int vscrollw;
- int vscrolll;
- };
-
- /* Macro for finding gadget */
- #define PointInBox(x,y,mx,my,MX,MY) ((x>=mx)&&(y>=my)&&(x<=MX)&&(y<=MY))
-
- /* Macros to access system gadget sizes */
- #define SYSISIZE(n) gs[n].sysisize
- #define SIZEIMAGE_W(n) gs[n].sizeimagew
- #define SIZEIMAGE_H(n) gs[n].sizeimageh
- #define LEFTIMAGE_W(n) gs[n].leftimagew
- #define LEFTIMAGE_H(n) gs[n].leftimageh
- #define DOWNIMAGE_W(n) gs[n].downimagew
- #define DOWNIMAGE_H(n) gs[n].downimageh
- #define UPIMAGE_W(n) gs[n].upimagew
- #define UPIMAGE_H(n) gs[n].upimageh
- #define RIGHTIMAGE_W(n) gs[n].rightimagew
- #define RIGHTIMAGE_H(n) gs[n].rightimageh
- #define CLOSEIMAGE_W(n) gs[n].closeimagew
- #define ZOOMIMAGE_W(n) gs[n].zoomimagew
- #define DEPTHIMAGE_W(n) gs[n].depthimagew
- #define VSCROLL_W(n) gs[n].vscrollw
- #define VSCROLL_L(n) gs[n].vscrolll
-
- /* defines for resolution for index */
- #define GS_LOWRES 0
- #define GS_MEDRES 1
-
- /* Pointer image structures */
- extern UWORD __chip Add[];
- extern UWORD __chip Del[];
- extern UWORD __chip L1[];
- extern UWORD __chip L2[];
- extern UWORD __chip Mov[];
- extern UWORD __chip One[];
- extern UWORD __chip Rel[];
- extern UWORD __chip Two[];
- extern UWORD __chip U1[];
- extern UWORD __chip U2[];
-
- /* Defines for the help system nodes
- * See "help.h" for the node text
- */
- #define H_Nothing 0
- #define H_Main 1
- #define HE_IFFBMHD 2
- #define HE_IFFRASTER 3
- #define HE_IFFBODY 4
- #define HE_IFFCLIP 5
- #define HE_IFFILBM 6
- #define HE_IFFFileS 7
- #define HE_IFFTOP 8
- #define HE_IFFMEM 9
- #define H_G24File2 10
- #define H_Width 11
- #define H_Height 12
- #define H_Single 13
- #define H_Frames 14
- #define H_Start 15
- #define H_Name 16
- #define H_GName 17
- #define H_EPoints 18
- #define H_IClose 19
- #define H_IZoom 20
- #define H_IDepth 21
- #define H_IM 22
- #define H_IMP 23
- #define H_IMS 24
- #define H_IMPO 25
- #define H_IMPS 26
- #define H_IMPSA 27
- #define H_IMPA 28
- #define H_IMPQ 29
- #define H_IMPE 30
- #define H_P_KS 31
- #define H_CWindow 32
- #define H_EOne 33
- #define H_ETwo 34
- #define H_ERel 35
- #define H_EAdd 36
- #define H_EDel 37
- #define H_ELnk 38
- #define H_EUnl 39
- #define H_EMov 40
- #define H_CClose 41
- #define H_CDepth 42
- #define H_CM 43
- #define H_CMP 44
- #define H_CMS 45
- #define H_CMPO 46
- #define H_CMPS 47
- #define H_CMPSA 48
- #define H_CMPA 49
- #define H_CMPE 50
- #define H_CMPQ 51
- #define H_P_LOADS 52
- #define H_CMSM 53
- #define H_EWindow 54
- #define H_Horiz 55
- #define H_Vert 56
- #define H_Up 57
- #define H_Down 58
- #define H_Left 59
- #define H_Right 60
- #define H_EClose 61
- #define H_EZoom 62
- #define H_EDepth 63
- #define H_ESize 64
- #define H_P_SAVES 65
- #define H_P_SAVESAS 66
- #define H_CME 67
- #define H_CMEG 68
- #define H_RAG 69
- #define H_RAGGX 70
- #define H_RAGGY 71
- #define H_RAGGOK 72
- #define H_RAGGCA 73
- #define H_RAGGCL 74
- #define H_RAGGDE 75
- #define H_IMPN 76
- #define H_CMPN 77
- #define HE_Size 78
- #define HE_OGrid 79
- #define HE_Grid0 80
- #define HE_MPoints 81
- #define H_IWindow 82
- #define H_FileOne 83
- #define H_GFileOne 84
- #define H_FileTwo 85
- #define H_GFileTwo 86
- #define H_24File1 87
- #define H_G24File1 88
- #define H_24File2 89
- #define HE_OMorph 90
- #define HE_Screen 91
- #define HE_Library 92
- #define HE_FileReq 93
- #define HE_WPort 94
- #define HE_IDevice 95
- #define HE_ISmall 96
- #define HE_IDifferent 97
- #define HE_ZRaster 98
- #define HE_Menu 99
- #define HE_OWindow 100
- #define HE_MemFile 101
- #define HE_AllocGadget 102
- #define HE_AllocImage 103
- #define HE_LoadImage 104
- #define HE_AllocIFF 105
- #define HE_AllocILBM 106
- #define HE_GetDRI 107
- #define HE_LockScreen 108
- #define HE_FileFormat 109
- #define HE_TooSmall 110
- #define HE_Range 111
- #define HE_MemPoints 112
- #define HE_InvLink 113
- #define HE_Close 114
- #define HE_Open 115
- #define HE_Write 116
- #define HE_4points 117
- #define HE_NotLinked 118
- #define HE_LinkSelf 119
- #define HE_Linked 120
- #define HE_UnlinkSelf 121
- #define HE_MemNewPoint 122
- #define H_Unsaved 123
- #define HE_OldFormat 124
- #define HC_First 125
- #define HC_Previous 126
- #define HC_Goto 127
- #define HC_Next 128
- #define HC_Last 129
- #define H_CMEF 130
- #define H_CMEFF 131
- #define H_CMEFP 132
- #define H_CMEFG 133
- #define H_CMEFN 134
- #define H_CMEFL 135
- #define HE_OneFrame 136
- #define HE_FAllSize 137
- #define H_IMPD 138
- #define H_FrameNumber 139
- #define H_P_CP 140
- #define H_P_CI 141
- #define H_P_CIP 142
- #define H_P_OM 143
- #define H_P_PS 144
- #define H_P_ZO 145
- #define H_P_CIR 146
- #define H_P_DE 147
- #define H_P_DX 148
- #define H_P_DY 149
- #define H_P_LS 150
- #define H_P_MO 151
- #define H_P_POS 152
- #define H_P_PES 153
- #define H_P_PSR 154
- #define H_P_QU 155
- #define H_P_SF 156
- #define H_S_RD 157
- #define H_S_LS 158
- #define H_S_R 159
- #define HE_SaveSettings 160
- #define HE_LoadSettings 161
- #define HE_OpalVision 162
- #define HE_AllocPlanes 163
- #define HE_NoOpal 164
- #define H_P_AA 165
- #define HE_NoFile 166
- #define H_P_HE 167
- #define H_HelpGad 168
- #define H_P_Preview 169
- #define H_IMPP 170
- #define H_CMPP 171
- #define H_Arexx 172
- #define H_PCUSTM 173
- #define H_PCUSTD 174
- #define HE_OScreen 175
- #define HE_DrawI 176
- #define HE_LockW 177
- #define HE_ScreenMode 178
- #define H_P_INT 179
- #define HE_CScreen 180
- #define H_CMET 181
-
- /* Defines for the Disabled Messages */
- #define DI_Zoom 1000
- #define DI_WaitSS 1001
- #define DI_WaitOpen 1002
- #define DI_WaitSave 1003
- #define DI_Delete 1004
- #define DI_About 1005
- #define DI_Image1 1006
- #define DI_Image2 1007
- #define DI_Draw 1008
- #define DI_Grid 1009
- #define DI_Unsaved 1010
- #define DI_Preview 1011
- #define DI_LoadBrush 1012
- #define DI_New 1013
- #define DI_GetFrame 1014
- #define DI_NextFrame 1015
- #define DI_Triangulate 1016
-
- /* TSMorph.c */
-
- /* Libraries */
- extern struct IntuitionBase *IntuitionBase;
- extern struct Library *GfxBase,
- *LayersBase,
- *InputBase,
- *IFFParseBase,
- *GadToolsBase,
- *AslBase,
- *UtilityBase,
- *DiskfontBase,
- *AmigaGuideBase,
- *IconBase,
- *ReqToolsBase,
- *RexxSysBase,
- *DCTVBase;
-
- extern struct OpalBase *OpalBase;
-
- /* Externals defined */
- extern struct gadgetsizing gs[]; /* Size of system gadgets */
- extern UWORD Mode; /* Current editing mode */
- extern struct List PointList; /* List of Points */
- extern struct Picture Pic1, /* 1st */
- Pic2; /* and 2nd images */
- extern BOOL Pic1_Open; /* If 1st */
- extern BOOL Pic2_Open; /* and 2nd images are open */
- extern struct FileRequester *filereq; /* General use file requester */
- extern struct rtFileRequester *rtfilereq; /* General use rt file requester */
- extern BOOL Saved; /* Set to FALSE after editing */
- extern char savedfilename[256]; /* Current project file name */
- extern LONG Width, /* Width and */
- Height; /* Height of project */
- extern LONG SinglePicture; /* TRUE for Warps */
- extern BOOL Zoom; /* TRUE if current Zoomed */
- extern BOOL ZoomAllowed; /* FALSE to save memory */
- extern BOOL PaletteAllowed; /* FALSE for compatibility */
- extern char **ArgArray; /* Parameter/ToolTypes */
- extern char **ArgArraySettings;/* From settings file */
- extern AMIGAGUIDECONTEXT handle; /* Help handle */
- extern BOOL palette; /* TRUE if Palette changed */
- extern BOOL CreateIcons;/* TRUE if to write Icons */
- extern BOOL CreateIconsR;/* TRUE if to write Render Icons */
- extern BOOL CreateIconsP;/* TRUE if to write prefs Icons */
- extern BOOL KeepSettings;/* TRUE to save settings on quit */
- extern ULONG DX;
- extern ULONG DY;
- extern char LoadScript[];
- extern char PreScript[];
- extern char PostScript[];
- extern char ScreenName[];
- extern char ScreenNameR[];
- extern char PreviewScript[];
- extern char CustomName[];
- extern ULONG CustomDepth;
- extern BOOL OpenedScreen;
- extern ULONG Depth;
- extern ULONG RenderMode;
- extern ULONG SaveFormat;
- extern ULONG Quality;
- extern ULONG ASig; /* Amiga guide signal */
- extern ULONG OpenMode; /* Open mode (opal etc.) */
- extern int changedboxcount; // Used to redraw points after resizing BOTH windows
- extern UWORD n; // Holds screen resolution
- extern LONG MaxWidth; // Max x of points
- extern LONG MaxHeight; // Max y of points
- extern BOOL AntiAlias; // Anti Alias?
- extern BOOL Integer; // Integer calculation?
- extern BOOL GHelp; // Gadget Help?
- extern struct NewAmigaGuide nag; // .guide stuff
- extern BOOL EGS; // Use EGS picture window
-
- extern UBYTE *message[]; // Messages
-
- /* Properties for IFF read */
- extern LONG props[];
- extern LONG stops[];
- extern LONG nowt[];
- extern LONG FrameNumber;
- extern USHORT __chip BusyPointerData[];
-
- /* Prototypes */
- void About(void);
- int main(int argc,char **argv);
- BOOL openAPicture(char *filename,struct Picture *Pic,BOOL Gui);
- void CloseAPicture(struct Picture *pic);
- void doNewSize(struct Picture *pic);
- void checkGadget(struct Picture *pic);
- void DrawPixels(struct Picture *pic,SHORT x,SHORT y,struct MyPoint *MyPoint);
- void DeleteAllPoints(void);
- BOOL MyOpen(char *filename,BOOL JustPoints,BOOL Gui);
- BOOL SaveAs(char *filename);
- void MySetMode(UWORD NewMode);
- void doMsgLoop(void);
- void SetMyPointer(void);
- int DoMenu(struct Picture *pic,UWORD Selection);
- void DisableWindows(ULONG dnum);
- void EnableWindows(void);
- void Vanilla(ULONG code);
- void MouseButtons(struct Picture *pic,ULONG code,ULONG seconds);
- void MouseMove(struct Picture *pic);
-
- /* Defines for Image movement gadgets IDS */
- #define NO_GADGET (0)
- #define UP_DOWN_GADGET (1)
- #define LEFT_RIGHT_GADGET (2)
- #define UP_GADGET (3)
- #define DOWN_GADGET (4)
- #define LEFT_GADGET (5)
- #define RIGHT_GADGET (6)
-
- /* Defines for Edit mode */
- #define EDIT1 1 // moving points in one window
- #define EDIT2 2 // moving points in both windows absolutely
- #define EDITREL 3 // moving points in both windows relatively
- #define ADD 4 // Adding points
- #define DELETE 5 // Deleting points
- #define LINK1 6 // Linking points - select 1st point
- #define UNLINK1 7 // Unlinkg points
- #define LINK2 8 // Linking points - select 2nd point
- #define LINK2A 9 // Linking points - 2nd point selected
- #define UNLINK2 10 // Unlinking points - select 2nd point
- #define UNLINK2A 11 // Unlinking points - 2n point selected
- #define NONE 12 // Just scrolling the windows
-
- /* Defines for menu items */
- #define M_PROJECT 0 // Project menu
-
- #define MM_NEW 0
- #define MM_OPEN 1
- #define MM_B1 2
- #define MM_SAVE 3
- #define MM_SAVEAS 4
- #define MM_B2 5
- #define MM_ABOUT 6
- #define MM_B3 7
- #define MM_EXITPOINTS 8
- #define MM_B4 9
- #define MM_QUIT 10
- #define MM_B5 11
- #define MM_PPREVIEW 12
-
- #define M_EDIT 1 // Edit menu
-
- #define MM_GRID 0
- #define MM_TRIANGULATE 1
- #define MM_FRAME 2 // Frame sub-menu
-
- #define MI_FIRST 0
- #define MI_PREV 1
- #define MI_GOTO 2
- #define MI_NEXT 3
- #define MI_LAST 4
-
- #define MM_MODE 3 // Mode sub-menu
-
- #define MI_EDITONE 0
- #define MI_EDITTWO 1
- #define MI_EDITREL 2
- #define MI_ADD 3
- #define MI_DELETE 4
- #define MI_LINK 5
- #define MI_UNLINK 6
- #define MI_NONE 7
-
- #define M_SETTINGS 2 // Settings menu
-
- #define MM_ICONS 0
- #define MM_PALETTE 1
- #define MM_ZOOM 2
- #define MM_OPENMODE 3
-
- #define MI_ALWAYS 0
- #define MI_IFILBM 1
- #define MI_IFCOLOURS 2
- #define MI_REMAP 3
- #define MI_OPAL 4
-
- #define MM_SCREEN 4
- #define MM_CUSTOM 5
- #define MM_CDEPTH 6
- #define MM_SPREVIEW 7
-
- #define MM_C1 8
- #define MM_ICONSP 9
- #define MM_KEEPS 10
- #define MM_LOADS 11
- #define MM_SAVES 12
- #define MM_SAVESAS 13
- #define MM_C2 14
- #define MM_ICONSR 15
- #define MM_DX 16
- #define MM_DY 17
- #define MM_LOADSCRIPT 18
- #define MM_PRESCRIPT 19
- #define MM_POSTSCRIPT 20
- #define MM_DEPTH 21
- #define MM_RENDERMODE 22
-
- #define MI_MODE1 0
- #define MI_MODE2 1
- #define MI_MODE4 2
- #define MI_MODE8 3
- #define MI_MODE16 4
-
- #define MM_SAVEFORMAT 23
-
- #define MI_ILBM24 0
- #define MI_OPAL24 1
- #define MI_OPAL24T 2
- #define MI_OPAL24F 3
- #define MI_OPAL24FT 4
- #define MI_JPEG 5
- #define MI_JPEGT 6
- #define MI_PBM 7
- #define MI_BW16 8
- #define MI_BW256 9
- #define MI_HAM6 10
- #define MI_HAM8 11
- #define MI_DCTV3 12
- #define MI_DCTV4 13
-
- #define MM_QUALITY 24
- #define MM_SCREENR 25
- #define MM_ANTIALIAS 26
- #define MM_INTEGER 27
- #define MM_C3 28
- #define MM_RESETD 29
- #define MM_LASTS 30
- #define MM_RESTORE 31
- #define MM_C4 32
- #define MM_HELP 33
-
- #define OPEN_ILBM_IF_ILBM MI_IFILBM // Open using iffparse if an ilbm <24 bits
- #define OPEN_ILBM_IF_COLOURS MI_IFCOLOURS // Open using iffparse if less colours than screen
- #define OPEN_ILBM_ALWAYS MI_ALWAYS // Open using iffparse only
- #define OPEN_REMAP MI_REMAP // Remap if possible
- #define OPEN_OPAL MI_OPAL // Always use opal.library and remap
-
- /* Subroutines.c */
-
- extern char TempFilename[256]; // File name used to get a file name
-
- /* Prototypes */
- void ihelp(ULONG helpnum);
- void help(ULONG helpnum);
- void ColorWindow(struct Picture *pic);
- void UnColorWindow(struct Picture *pic);
- void MyArgArrayInit(int argc,char **argv);
- void MyArgArrayDone(void);
- UBYTE *MyArgString(UBYTE *arg2,UBYTE *arg3,BOOL reopen);
- LONG MyArgInt(UBYTE *arg2, long arg3,BOOL reopen);
- BOOL MyFindToolType(UBYTE *arg2,BOOL reopen);
- void OpenNewArgs(UBYTE *filename);
- void CloseWindowSafely(struct Window *win);
- void StripIntuiMessages(struct MsgPort *mp,struct Window *win);
- void Error(char *ErrorMessage,char *Gadget,char *extra,ULONG helpnum);
- void XError(struct Picture *pic,char *ErrorMessage,char *Gadget,char *extra,ULONG helpnum);
- void DrawAllPoints(void);
- void OpenPointsEdit(void);
- void AddGrid(void);
- void ReallyAddGrid(void);
- void DoMenuHelp(USHORT code);
- BOOL SaveRequester(void);
- void LinkPoints(struct MyPoint* MyPoint,struct MyPoint *MyPoint1);
- void UnlinkPoints(struct MyPoint* MyPoint,struct MyPoint *MyPoint1,BOOL Draw);
- void UnlinkAllPoints(BOOL Draw);
- struct MyPoint *FindPoint(struct Picture *pic,WORD x,WORD y);
- VOID DeletePoint(struct MyPoint* MyPoint);
- void MyDraw(struct RastPort *rp, SHORT x, SHORT y, SHORT oldx, SHORT oldy);
- void EGSMyDraw(struct EG_RastPort *rp, SHORT x, SHORT y, SHORT oldx, SHORT oldy);
- BOOL GetAFile(char *name,char *Prompt,ULONG flags);
- void LimitPoints(SHORT *x,SHORT *y,struct Picture *pic);
- void InitParams(BOOL firstcall);
- void UpdateParams(ULONG OZoom);
- int Preview(void);
- LONG SendRxMsg(char *msgtxt,BOOL IgnoreError);
- BOOL OpenCustomScreen(void);
- void CloseCustomScreen(void);
- void Triangulate(void);
- BOOL GenerateTriangles(void);
- int *IntVect(int ncols);
- void MyFreeVecti(int *vectptr);
- int **IntMatrix(int nrows, int ncols);
- void FreeMatrixi(int **matptr);
- double **DoubleMatrix(int nrows, int ncols);
- void FreeMatrixd(double **matptr);
-
- /* Brush images */
- extern struct Image Add_im;
- extern struct Image Del_im;
- extern struct Image Link_im;
- extern struct Image None_im;
- extern struct Image One_im;
- extern struct Image Rel_im;
- extern struct Image Two_im;
- extern struct Image Unlink_im;
- extern struct Image st_im;
- extern struct Image prev_im;
- extern struct Image goto_im;
- extern struct Image next_im;
- extern struct Image last_im;
-
- extern struct Image Add_imx;
- extern struct Image Del_imx;
- extern struct Image Link_imx;
- extern struct Image None_imx;
- extern struct Image One_imx;
- extern struct Image Rel_imx;
- extern struct Image Two_imx;
- extern struct Image Unlink_imx;
- extern struct Image st_imx;
- extern struct Image prev_imx;
- extern struct Image goto_imx;
- extern struct Image next_imx;
- extern struct Image last_imx;
-
- /* LoadBrushes.c */
- int myloadbrush(struct ILBMInfo *info,UBYTE *filename);
- void mycopysprite(struct ILBMInfo *ilbm,UWORD *address,UBYTE *filaname);
- void mycopybrush(struct ILBMInfo *ilbm,struct Image *im,UBYTE *filename,UWORD size);
- void invertbrush(struct Image *im,UWORD size);
- void LoadBrushes(void);
-
- /* ControlWindow.c */
-
- /* Gadgets */
- extern struct Gadget OneGadget;
- extern struct Gadget TwoGadget;
- extern struct Gadget RelGadget;
- extern struct Gadget MyAddGadget;
- extern struct Gadget DelGadget;
- extern struct Gadget LinkGadget;
- extern struct Gadget UnlinkGadget;
- extern struct Gadget NoneGadget;
- extern struct Gadget stGadget;
- extern struct Gadget prevGadget;
- extern struct Gadget gotoGadget;
- extern struct Gadget nextGadget;
- extern struct Gadget lastGadget;
-
- /* Defines for Image sizes */
- #define IMAGE_WIDTH 38 /* The width of a Control Window gadget */
- #define IMAGE_HEIGHT 34 /* and the Height */
- #define AIMAGE 15 /* Arrow image size */
-
- /* Defines for menu items in array */
- #define NM_PROJECT 0
- #define NM_NEWPOINTS 1
- #define NM_OPENPOINTS 2
-
- #define NM_SAVE 4
- #define NM_SAVEAS 5
-
- #define NM_ABOUT 7
-
- #define NM_EXITPOINTS 9
-
- #define NM_QUIT 11
-
- #define NM_PPREVIEW 13
-
- #define NM_EDIT 14
- #define NM_ADDGRID 15
- #define NM_TRIANGULATE 16
- #define NM_FRAME 17
- #define NM_FIRST 18
- #define NM_PREVIOUS 19
- #define NM_GOTO 20
- #define NM_NEXT 21
- #define NM_LAST 22
- #define NM_EMODE 23
- #define NM_M_ONE 24
- #define NM_M_TWO 25
- #define NM_M_REL 26
- #define NM_M_ADD 27
- #define NM_M_DEL 28
- #define NM_M_LNK 29
- #define NM_M_UNL 30
- #define NM_M_MOV 31
- #define NM_SETTINGS 32
- #define NM_CREATEICONS 33
- #define NM_CHANGEPALETTE 34
- #define NM_ZOOM 35
- #define NM_OPENMODE 36
- #define NM_ILBMALWAYS 37
- #define NM_ILBMIFILBM 38
- #define NM_ILBMIFCOLOURS 39
- #define NM_REMAP 40
- #define NM_ILBMOPAL 41
- #define NM_SCREEN 42
- #define NM_CUSTOM 43
- #define NM_CDEPTH 44
- #define NM_SPREVIEW 45
-
- #define NM_ICONSP 47
- #define NM_KEEPS 48
- #define NM_LOADS 49
- #define NM_SAVES 50
- #define NM_SAVESAS 51
-
- #define NM_ICONSR 53
- #define NM_DX 54
- #define NM_DY 55
- #define NM_LOADSCRIPT 56
- #define NM_PRESCRIPT 57
- #define NM_POSTSCRIPT 58
- #define NM_DEPTH 59
- #define NM_MODE 60
- #define NM_MODE1 61
- #define NM_MODE2 62
- #define NM_MODE4 63
- #define NM_MODE8 64
- #define NM_MODE16 65
- #define NM_SAVEFORMAT 66
- #define NM_ILBM24 67
- #define NM_OPAL24 68
- #define NM_OPAL24T 69
- #define NM_OPAL24F 70
- #define NM_OPAL24FT 71
- #define NM_OPALJPEG 72
- #define NM_OPALJPEGT 73
- #define NM_PBM 74
- #define NM_BW16 75
- #define NM_BW256 76
- #define NM_HAM6 77
- #define NM_HAM8 78
- #define NM_DCTV3 79
- #define NM_DCTV4 80
- #define NM_QUALITY 81
- #define NM_SCREENR 82
- #define NM_ANTIALIAS 83
- #define NM_INTEGER 84
-
- #define NM_RESETD 86
- #define NM_LASTS 87
- #define NM_RESTORE 88
-
- #define NM_HELP 90
-
- /* Externals defined */
- extern struct NewMenu MyNewMenu[];
- extern struct Window *ControlWindow;
- extern struct Menu *MyMenu;
- extern UBYTE *CWTitle;
-
- /* Prototypes */
- struct Window *OpenControlWindow(void);
- void CloseControlWindow(void);
- void UpdateMenuDefs(void);
-
- /* help.c */
- extern unsigned char *context[];
- extern unsigned char *ShortHelp[];
- extern unsigned char *disabled[];
-
- /* Args.c */
- void argArrayDone( void );
- char **argArrayInit( LONG argc, char **argv );
-
- /* Frames.c */
- int FirstFrame(void);
- int PrevFrame(void);
- int GotoFrame(void);
- int NextFrame(void);
- int LastFrame(void);
- BOOL GetFrameNumber(void);
- int ReopenPictures(void);
- BOOL ReopenAPicture(char *filename,struct Picture *pic);
-
- /* OpalLoad.c */
-
- extern UWORD FileFormat;
-
- /* recognized file formats */
- #define FORMAT_IFF 1
- #define FORMAT_JPEG 2
- #define FORMAT_GIF 3
- #define FORMAT_PPM 4
- #define FORMAT_TARGA 5
-
- extern struct RastPort RP, // Work Rast Ports
- TRP;
- extern struct BitMap TBM; // Temp bitmap
- extern UBYTE *plane0; // Planes for temporary bit maps
- extern UBYTE *plane1;
- extern UBYTE *plane2;
- extern UBYTE *plane3;
- extern UBYTE *plane4;
- extern UBYTE *plane5;
- extern UBYTE *plane6;
- extern UBYTE *plane7;
- extern UBYTE *Array;
-
- BOOL MyLoadBrush(struct Picture *pic,UBYTE *filename);
- BOOL OpalLoad(struct Picture *pic,UBYTE *filename);
- BOOL InitArray(UWORD w);
- void FreeArray(void);
- BOOL ChunkyToPlanar(struct Picture *pic,UWORD width,UWORD height,UBYTE *chunky);
- void RGBToScreen000(UBYTE *red,UBYTE *green,UBYTE *blue,UWORD Height,UWORD Width,
- UWORD maxcol,UWORD xadd,UBYTE *r,UBYTE *g,UBYTE *b);
- BOOL PlanarToChunky(struct Picture *pic,UWORD w,UWORD h,UBYTE *r,UBYTE *g,UBYTE *b);
- void PaletteToScreen000(struct RastPort *Rp,struct Picture *Pic,UWORD maxcol,
- UBYTE *r,UBYTE *g,UBYTE *b);
- void PaletteToEGS000(struct RastPort *Rp,struct Picture *pic,UBYTE *plane,UBYTE *r,UBYTE *g,UBYTE *b);
-
- /* HandleSettings.c */
- void RemoveMenus(void);
- void AddMenus(void);
- void UpdateSaveFormat(BOOL remove);
- void UpdateRenderMode(BOOL remove);
- void UpdateOpenMode(BOOL remove);
- void UnZoom(void);
- void ReZoom(void);
- void SwitchMenuItem(UWORD pos,BOOL setting,BOOL remove);
- void HandleSettings(UWORD Selection,struct Picture *pic);
- void GetANumber(char *title,ULONG *number,ULONG HelpNum);
- void GetAString(char *title,char *buffer,ULONG HelpNum);
-
- void SaveSettings(char *filename);
- void LoadSettings(char *filename);
-
- /* RGBToScreen020.c */
- void PaletteToScreen020(struct RastPort *Rp,struct Picture *Pic,UWORD maxcol,
- UBYTE *r,UBYTE *g,UBYTE *b);
- void RGBToScreen020(UBYTE *red,UBYTE *green,UBYTE *blue,UWORD Height,UWORD Width,
- UWORD maxcol,UWORD xadd,UBYTE *r,UBYTE *g,UBYTE *b);
- void PaletteToEGS020(struct RastPort *Rp,struct Picture *pic,UBYTE *plane,UBYTE *r,UBYTE *g,UBYTE *b);
-
- /* Messages.c */
- // char *MyGetMsg(UWORD MsgNo);
- #define MyGetMsg(MsgNo) message[MsgNo]
-
- #endif
-